// 登录相关接口
import { baseUrl, AxiosApi, Post } from '../server'

const severName = 'base/kmUser/' // 服务前缀名
const newBaseUrl = baseUrl + severName

// 获取验证码
const getCaptcha: any = (randomString: string) => {
  // const url ='https://saas-mgr-dev2.tiens.com.cn/base/' + `captcha?key=${randomString}`
  const url = newBaseUrl + `captcha?key=${randomString}`
  return AxiosApi('get', url, {}, {}, 'arraybuffer')
}

// 登录
const login: any = (data: any) => {
  // const url = 'https://saas-mgr-dev2.tiens.com.cn/base/kmUser/login'
  const url = newBaseUrl + `login`
  return Post(url, data)
}

export const loginApi: any = {
  getCaptcha,
  login,
}
